# 搜索骨科—>点击搜索—>点击出来的第一个链接—>断言文本内容

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Edge()
driver.get("http://www.bjhospital.net/")
driver.maximize_window()
driver.implicitly_wait(5)

# driver.find_element(By.CLASS_NAME,"keyword").send_keys("骨科")
driver.find_element(By.NAME,"q").send_keys("骨科")


driver.find_element(By.XPATH,'//*[@id="header"]/div/div/div/form/button').click()


driver.find_element(By.XPATH,'/html/body/div[4]/ul/li[1]/div[1]/h5/a').click()

win = driver.window_handles
driver.switch_to.window(win[-1])
text = driver.find_element(By.XPATH,'/html/body/div[3]/div/div/article/h1').text
# text = driver.find_element(By.CLASS_NAME,'content').text
assert text=="毕节市第一人民医院高值医用耗材网上阳光平台议价意向公开"

time.sleep(2)


